package com.auxgroup.hr.front.site.co.common;

import java.util.List;

import javax.annotation.Resource;

import com.auxgroup.hr.front.site.co.BaseCO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.auxgroup.hr.front.commons.BaseRetCode;
import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsBankEcTbl;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.personnal.BankEcTblService;
import com.auxgroup.hr.front.site.co.BaseCO;

/**
 * 银行CDCO
 * 
 * @author wangchangyun
 * @version 创建时间：180527
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/bankEcTbl")
public class BankEcTblCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(BankEcTblCO.class);

	@Autowired
	public BankEcTblService bankEcTblService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 获取银行CD
	 * 
	 * @param hireId
	 * @return
	 */
	@GetMapping(value = "/getOne")
	public BaseResponseVO getOne(String bankCd) {
		logger.info("getBankEcTbl param= {}", bankCd);
		if(StringUtils.isBlank(bankCd)){
			buildRespone(BaseRetCode.CODE_ERROR_REQUEST_PARAM_NULL);
		}
		PsBankEcTbl bankEcTbl = bankEcTblService.getBankEcTbl(bankCd);
		logger.info("getBankEcTbl result= {}", bankEcTbl);
		return buildRespone(bankEcTbl,false);
	}

	/**
	 * 获取全部银行CD
	 * 
	 * @param rsHireId
	 * @return
	 */
	@GetMapping(value = "/getAll")
	public BaseResponseVO getAll() {
		List<PsBankEcTbl> list = bankEcTblService.getAll();
		logger.info("getAllBankEcTbl result= {}", list);
		return buildRespone(list,false);
	}

}
